package com.kotlin1.test.mys1

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.os.Looper
import android.widget.TextView
import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.*

class MainActivity : AppCompatActivity(),AnkoLogger {
    private lateinit var textView:TextView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
       // textView = findViewById(R.id.textview) as TextView
        textView = find(R.id.textview)
        //textview.text
        textView.append("\nhello kotlin")
        textview.append("\t kotlinx activity_main")
        textView.onClick { toast(R.string.app_name)
            //startActivity<MainActivity>("from"to"MainActivity")
            info { "6.1 happy " }
            debug ("8899")
            warn { "wwwww" }
            doAsync {
                warn { "uiThread ? "+(Looper.myLooper()==mainLooper) +", "+Thread.currentThread().name}
                Thread.sleep(500)
                uiThread {
                    textview.append("\n ui")
                }
            }
        }
    }
}
